package org.dizem.minichat.model;

import craky.util.Config;
import org.dizem.minichat.Constants;
import org.dizem.minichat.service.ClientMonitor;
import org.dizem.minichat.view.client.LoginFrame;
import org.dizem.minichat.view.client.MainFrame;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

/**
 * User: DIZEM
 * Time: 11-3-26 上午9:39
 */
public class Client {

	private Config config, loginConfig;
	private MainFrame mainFrame;
	private LoginFrame loginFrame;
	private Timer gcTimer;
	private List<String> loginHistory;
	private List<Address> serverHistory;



	public Client() {
//		this.config = new Config(Constants.CONFIG_PATH);
//		this.loginConfig = new Config(Constants.LOGIN_CONFIG_PATH);
//		this.loginHistory = new ArrayList<String>(Constants.MAX_HISTORY_USER_COUNT);
		new ClientMonitor(this).start();

	}

	public void startGC() {
		int delay = Integer.parseInt(config.getProperty(Constants.GC_PERIOD, "5000"));

		gcTimer = new Timer(delay, new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.gc();
			}
		});

		gcTimer.start();
	}

	public static void main(String[] args) {

	}
}
